#include"err.hpp"
#include"log.hpp"
#include"select_server.hpp"
#include <string>



void user(const std::string& str)
{
    std::cout << "use error !!!!! \n\t   user-> " << str <<" [port_number] \n\n"
              << std::endl;
}
std::string callback(std::string& request)
{
    std::string ret ="";
    ret += "server echo: ";
    ret += request;
    return ret;
}
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        user("test");
        return 1;
    }

    int16_t port = std::stoi(argv[1]);
    // int16_t port = std::stoi(std::string(argv[1]));

    zxf::Select_server ss(port);
    // 守护进程化
    // daemonSelf();
    // 就和当前会话无关了

    ss.initServer();
    ss.start(callback);

    return 0;
}
